package cn.ronghuanet.client;

import cn.ronghuanet.domain.Order;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.Arrays;
import java.util.List;

@Component
public class OrderClientFallbackFactory implements FallbackFactory<OrderClient> {
    @Override
    public OrderClient create(Throwable throwable) {
        return new OrderClient() {
            @Override
            public List<Order> getOrderByUid(Long uid) {
                throwable.printStackTrace();
                return Arrays.asList(new Order(-1L,"order1",uid));
            }
        };
    }
}
